pub mod js {
    use wasm_bindgen::prelude::*;
    #[wasm_bindgen]
    extern "C" {
        #[wasm_bindgen(js_namespace = Math, js_name = random)]
        pub fn random() -> f64;

        #[wasm_bindgen(js_namespace = console, js_name = log)]
        pub fn log_str(a:&str);
    }

    macro_rules! random_range {
        ($first:expr, $end:expr, $t:ty) => {
            {
                let a = $end - $first;
                let b = random() * (a as f64);
                let c = b + ($first as f64);
                c as $t
            }
        };
    }

    #[allow(dead_code)]
    pub fn random_range_i(first:isize, end:isize) -> isize {
        random_range!(first, end, isize)
    }

    pub fn random_range_u(first:usize, end:usize) -> usize {
        random_range!(first, end, usize)
    }
}
